{% extends "openlavaweb/base.html" %}
{% block content %}
<div id="failMessageBody"></div>
<div id="killMessageBody"></div>
<div id="suspendMessageBody"></div>
<div id="resumeMessageBody"></div>
<div id="requeuePendMessageBody"></div>
<div id="requeueHoldMessageBody"></div>
<div id="statusMessageBody"></div>

<script>
    var url='{% url "olw_job_view_array" job.job_id job.array_index %}';
    var killUrl='{% url "olw_job_kill" job.job_id job.array_index %}';
    var suspendUrl='{% url "olw_job_suspend" job.job_id job.array_index %}';
    var resumeUrl='{% url "olw_job_resume" job.job_id job.array_index %}';
    var requeueHoldUrl='{% url "olw_job_requeue" job.job_id job.array_index %}?hold=1';
    var requeuePendUrl='{% url "olw_job_requeue" job.job_id job.array_index %}';

	function setStatus(message,cls) {
		var html='<div id="statusMessage" class="fade in alert alert-'+cls+'">'+message+'</div>';
		var m = $("#statusMessageBody");
        if (m.html() != html ) {
            m.html(html);
		}
	}

	function updateJobInfo(job) {
		if (job.is_pending){
			setStatus("<strong>Pending</strong>: The job is currently pending.  The scheduler has not executed the job yet because of the following reasons:  {{ job.pending_reasons}}", "info");
		}else if (job.is_running){
			setStatus("<strong>Running</strong>: The job is currently running.","success");
		}else if (job.is_suspended) {
			setStatus("<strong>Suspended</strong>: The job is currently suspended.  The job is suspended because of the following reasons:  {{ job.suspension_reasons}}","warning");
		}else if (job.is_failed) {
			setStatus("<strong>Failed</strong>: The job has failed.", "danger");
		}else if (job.is_completed) {
			setStatus("<strong>Completed</strong>: The job has finished.","success");
		}else{
			setStatus("<strong>Unknown</strong>: Unable to determine state of job","warning");
		}
		$("#status").text(job.status['friendly'] + ": " + job.status['description']);

        $("#queue").html("<a href='"+ job.queue.url +"'>" + job.queue.name + "</a>");
        $("#cpuTimeConsumed").text(job.cpu_time_timedelta);
        // Todo: create CPU Time Timedelta

		var html="";
		jQuery.each(job.execution_hosts, function(index, host) {
			html+="<a href='" + host.url + "'>" + host.name + "(" + host.num_processors + ")</a> ";
		});
		if (html == "") {
			html="Not executing";
		}
		$("#executionHosts").html(html);

		if (job.reservation_time > 0) {
			$("reservationTime").text(olwclient.Job.dateToString(job.reservation_time_datetime()));
		}
		if (job.start_time > 0) {
			$("startTime").text(olwclient.Job.dateToString(job.start_time_datetime()));
		}
		if (job.predicted_start_time > 0) {
			$("predictedStartTime").text(olwclient.Job.dateToString(job.predicted_start_time_datetime()));
		}
		if (job.end_time > 0) {
			$("endTime").text(olwclient.Job.dateToString(job.end_time_datetime()));
		}


        html="";
		jQuery.each(job.consumed_resources, function(index, res) {
			html+="<tr><th>" + res.name + "</th><td>" + res.value;
			if (res.unit){
				html+=res.unit;
			}
			html+="</td><td>";
			if (res.limit) {
				html+=res.limit;
			}else{
				html+="No Limit";
			}
			html+="</td></tr>";		
		});
		$("#consumedResources").empty();
		$("#consumedResources").html(html);
		
		
		html="";
		jQuery.each(job.processes, function(index, proc) {
			html+="<tr>";
			html+="<td>";
			if (proc.hostname) {
				html+=proc.hostname;
			}else{
				html+="Unknown";
			}
			html+="</td><td>";
			html+=proc.process_id;
			html+="</td>";
			if (job.cluster_type=="openlava") {
				html+="<td>" + proc.parent_process_id + "</td>";
				html+="<td>" + proc.process_group_id + "</td>";
				html+="<td>" + proc.cray_job_id + "</td>";
			}
			html+="</tr>";
		});
		$("#processes").empty();
		$("#processes").html(html);

        if (job.type == "openlava") {
            $("#executionHomeDir").text(job.execution_home_dir);
            $("#executionCwd").text(job.execution_cwd);
            $("#executionUserName").text(job.execution_user_name + " (" + job.execution_user_id + ")");
            $("#resourceUsageLastUpdateTime").text(new Date(job.resource_usage_last_update_time));
            $("#servicePort").text(job.service_port);
            $("#pid").text(job.process_id);
        }
	}
		
	function update(){
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.Job.getJob('{{job.job_id}}', '{{ job.array_index }}', function(job) {
            updateJobInfo(job);
            setTimeout(update, 30000);
        }, function(exception, message){
            $("#failMessageBody").html('<div id="failMessage" class="fade in alert alert-danger">Error! Unable to load job information: ' + message + '</div>');
            $("#failMessage").alert();
            $("#statusMessageBody").empty();
            setTimeout(function(){
                $("#failMessage").alert('close');
            },15000);
        });
	}
	update();
	
    function killJob() {
        $("#killModal").modal('hide');
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.killJob('{{ job.job_id}}', '{{ job.array_index}}', function(){
                    $("#killMessageBody").html('<div id="killMessage" class="fade in alert alert-success">Job kill request sent successfully.</div>');
                    $("#killMessage").alert();
                    setTimeout(function () {
                        $("#killMessage").alert('close');
                    }, 10000);
                },
                function (errType, message) {
                    $("#killMessageBody").html('<div id="killMessage" class="fade in alert alert-warning">Unable to kill job: ' + message + '</div>');
                    $("#killMessage").alert();
                    setTimeout(function () {
                        $("#killMessage").alert('close');
                    }, 10000);
                });
    }

    function suspendJob() {
        $("#suspendModal").modal('hide');
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.suspendJob('{{ job.job_id}}', '{{ job.array_index}}', function () {
                    $("#suspendMessageBody").html('<div id="suspendMessage" class="fade in alert alert-success">Job suspend request sent successfully.</div>');
                    $("#suspendMessage").alert();
                    setTimeout(function () {
                        $("#suspendMessage").alert('close');
                    }, 10000);
                },
                function (errType, message) {
                    $("#suspendMessageBody").html('<div id="suspendMessage" class="fade in alert alert-warning">Unable to suspend job: ' + message + '</div>');
                    $("#suspendMessage").alert();
                    setTimeout(function () {
                        $("#suspendMessage").alert('close');
                    }, 10000);
                });
    }

    function resumeJob(){
        $("#resumeModal").modal('hide');
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.resumeJob('{{ job.job_id}}', '{{ job.array_index}}', function () {
                    $("#resumeMessageBody").html('<div id="resumeMessage" class="fade in alert alert-success">Job resume request sent successfully.</div>');
                    $("#resumeMessage").alert();
                    setTimeout(function(){
                        $("#resumeMessage").alert('close');
                    },10000);
                },
                function (errType, message) {
                    $("#resumeMessageBody").html('<div id="resumeMessage" class="fade in alert alert-warning">Unable to resume job: ' + message + '</div>');
                    $("#resumeMessage").alert();
                    setTimeout(function(){
                        $("#resumeMessage").alert('close');
                    },10000);
                });
    }

    function requeueHoldJob() {
        $("#requeueHoldModal").modal('hide');
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.requeueJob('{{ job.job_id}}', '{{ job.array_index}}', true, function () {
                    $("#requeueHoldMessageBody").html('<div id="requeueHoldMessage" class="fade in alert alert-success">Job requeue request sent successfully.</div>');
                    $("#requeueHoldMessage").alert();
                    setTimeout(function () {
                        $("#requeueHoldMessage").alert('close');
                    }, 10000);

                },
                function (errType, message) {
                    $("#requeueHoldMessageBody").html('<div id="requeueHoldMessage" class="fade in alert alert-warning">Unable to requeue job: ' + message + '</div>');
                    $("#requeueHoldMessage").alert();
                    setTimeout(function () {
                        $("#requeueHoldMessage").alert('close');
                    }, 10000);
                });
    }


    function requeuePendJob() {
        $("#requeuePendModal").modal('hide');
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.requeueJob('{{ job.job_id}}', '{{ job.array_index}}', false, function () {
                    $("#requeuePendMessageBody").html('<div id="requeuePendMessage" class="fade in alert alert-success">Job requeue request sent successfully.</div>');
                    $("#requeuePendMessage").alert();
                    setTimeout(function () {
                        $("#requeuePendMessage").alert('close');
                    }, 10000);
                },
                function (errType, message) {
                    $("#requeuePendMessageBody").html('<div id="requeuePendMessage" class="fade in alert alert-warning">Unable to requeue job: ' + message + '</div>');
                    $("#requeuePendMessage").alert();
                    setTimeout(function () {
                        $("#requeuePendMessage").alert('close');
                    }, 10000);
                });
    }


</script>

{% if job.is_pending %}
    <script>setStatus("<strong>Pending</strong>: The job is currently pending.  The scheduler has not executed the job yet because of the following reasons:  {{ job.pending_reasons}}", "info");</script>
{% elif job.is_running %}
    <script>setStatus("<strong>Running</strong>: The job is currently running.","success");</script>
{% elif job.is_suspended %}
    <script>setStatus("<strong>Suspended</strong>: The job is currently suspended.  The job is suspended because of the following reasons:  {{ job.suspension_reasons}}","warning");</script>
{% elif job.is_failed %}
    <script>setStatus("<strong>Failed</strong>: The job failed.  The job exited with a non-zero exit status.","danger");</script>
{% elif job.was_killed %}
    <script>setStatus("<strong>Killed</strong>: The job was killed.  The job was killed, either by the owner, or a cluster administrator.","warning");</script>
{% elif job.is_completed %}
    <script>setStatus("<strong>Completed</strong>: The job has finished.  The job has finished.","success");</script>
{% endif %}

<!-- Job Manangement -->
<div>
	<div class="btn-group">
		<button type="button" class="btn dropdown-toggle btn-lg btn-primary {% if user.username in job.admins %}active{%else%}disabled{% endif %}" data-toggle="dropdown" >Requeue<span class="caret"></span></button>
		<ul class="dropdown-menu" role="menu">
            {% if user.username in job.admins %}
                <li><a href="#" data-toggle="modal" data-target="#requeuePendModal">Restart (PEND)</a></li>
                <li><a href="#" data-toggle="modal" data-target="#requeueHoldModal">Hold (PSUSP)</a></li>
            {% else %}
                <li><a href="#" class="disabled" data-toggle="modal" data-target="#requeuePendModal">Restart (PEND)</a></li>
                <li><a href="#" class="disabled" data-toggle="modal" data-target="#requeueHoldModal">Hold (PSUSP)</a></li>
            {% endif %}
		</ul>
	</div>
	<button class="btn btn-primary btn-lg {% if user.username in job.admins %}active{%else%}disabled{% endif %}" data-toggle="modal" data-target="#killModal">Kill </button>
	<button class="btn btn-primary btn-lg {% if user.username in job.admins %}active{%else%}disabled{% endif %}" data-toggle="modal" data-target="#suspendModal">Suspend</button>
	<button class="btn btn-primary btn-lg {% if user.username in job.admins %}active{%else%}disabled{% endif %}" data-toggle="modal" data-target="#resumeModal">Resume</button>
	
	<div class="modal fade" id="killModal" tabindex="-1" role="dialog" aria-labelledby="myKillModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myKillModalLabel">Kill Job?</h4>
				</div>
				<div class="modal-body">
					If the job is running, it shall be terminated with a SIGTERM signal. The job will be removed from the queue, and will not be automatically restarted.
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
					<button onClick="killJob(); return false;" type="button" class="btn btn-primary">Kill</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->                                                                                                                
	</div>
	<div class="modal fade" id="suspendModal" tabindex="-1" role="dialog" aria-labelledby="mySuspendModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="mySuspendModalLabel">Suspend Job?</h4>
				</div>
				<div class="modal-body">
					If the job is running, it shall be sent a SIGSTOP signal. The job will enter the USUSP or PSUSP state.
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
					<button onClick="suspendJob(); return false;" type="button" class="btn btn-primary">Suspend</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->                                                                                                                
	</div>
	<div class="modal fade" id="resumeModal" tabindex="-1" role="dialog" aria-labelledby="myResumeModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myResumeModalLabel">Resume Job?</h4>
				</div>
				<div class="modal-body">
					If the job is running, it shall be sent a SIGCONT signal. The job will move to either a RUN or PEND state.
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
					<button onClick="resumeJob(); return false;" type="button" class="btn btn-primary">Resume</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->                                                                                                                
	</div>

<div class="modal fade" id="requeuePendModal" tabindex="-1" role="dialog" aria-labelledby="myrequeueModalLabel" aria-hidden="true">
        <div class="modal-dialog">
                <div class="modal-content">
                        <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <h4 class="modal-title" id="myrequeueModalLabel">Requeue Job?</h4>
                        </div>
                        <div class="modal-body">
                                If the job is running, it shall be sent a SIGTERM signal. The job shall be requeued and will pend until resources are available to execute it.
                        </div>
                        <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                                <button onClick="requeuePendJob(); return false;" type="button" class="btn btn-primary">Requeue</button>
                        </div>
                </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->                                                                                                                
</div>

<div class="modal fade" id="requeueHoldModal" tabindex="-1" role="dialog" aria-labelledby="myRequeueHoldModalLabel" aria-hidden="true">
        <div class="modal-dialog">
                <div class="modal-content">
                        <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <h4 class="modal-title" id="myRequeueHoldModalLabel">Resume Job?</h4>
                        </div>
                        <div class="modal-body">
                                If the job is running, it shall be sent a SIGTERM signal. The job will be requeued, however it will be suspended, and will not execute until it has been unsuspended by the user.
                        </div>
                        <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                                <button onClick="requeueHoldJob(); return false;" type="button" class="btn btn-primary">Requeue</button>
                        </div>
                </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->                                                                                                                
</div>



</div>

<!-- Job Info -->
<h1>Job: {{ job.job_id }} {% if job.array_array_index > 0 %} Array Index: {{ job.array_index }}{% endif %}</h1>
<dl class="dl-horizontal">
	<dt>Job ID</dt><dd><a href="{% url 'olw_job_list' job.job_id %}">{{ job.job_id }}</a></dd>
	<dt>Array Index ID</dt><dd>{{ job.array_index }}</dd>
	<dt>Status</dt>	<dd id="status">{{ job.status.friendly }}: {{ job.status.description }}</dd>
    {% if job.status.name == "JOB_STAT_RUN" %}
    <dt>Standard Output</dt><dd id="output"><a href='{% url "olw_job_output" job.job_id job.array_index %}'>View Standard Output</a></dd>
    <dt>Standard Error</dt><dd id="error"><a href='{% url "olw_job_error" job.job_id job.array_index %}'>View Standard Error</a></dd>
    {% endif %}
	<dt>Username</dt><dd><a href='{% url "olw_user_view" job.user_name %}'>{{ job.user_name }}</a></dd>
	<dt>Process ID</dt><dd id="pid">{% if job.process_id > 0 %}{{ job.process_id }}{% else %}Not Available{% endif %}</dd>
	<dt>CPU Time Consumed</dt><dd id="cpuTimeConsumed">{{ job.cpu_time_timedelta }}</dd>
	<dt>Current Working Directory</dt><dd>{{ job.cwd }}</dd>
	<dt>Submission Host</dt><dd>{{ job.submission_host.host_name }}</dd>
	<dt>Execution Hosts</dt><dd id="executionHosts">{% for h in job.execution_hosts %} <a href='{% url "olw_host_view" h.host_name %}'>{{ h.host_name }} ({{ h.num_slots_for_job }} Slots)</a> {% empty %}Not executing{% endfor %}</dd>
	<dt>Job Name</dt><dd>{{ job.name }}</dd>
	<dt>Job Priority</dt><dd id="priority">{{ job.priority }}</dd>
	<dt>Job Admins</dt><dd>{% for admin in job.admins %}{{ admin }}{% if not forloop.last %}<br />{% endif %}{% endfor %}</dd>
	<dt>Submission Time</dt><dd>{{ job.submit_time_datetime_local }}</dd>
	<dt>Reservation Time</dt><dd id="reservationTime">{% if job.reservation_time > 0 %}{{ job.reservation_time_datetime_local }}{% else %}Not Specified{% endif %}</dd>
	<dt>Start Time</dt><dd id="startTime">{% if job.start_time > 0 %}{{ job.start_time_datetime_local}}{% else %}Not yet started{% endif %}</dd>
	<dt>Predicted Start Time</dt><dd id="predictedStartTime">{% if job.predicted_start_time > 0 %}{{ job.predicted_start_time_datetime_local }}{% else %}Not Available{% endif %}</dd>
	<dt>End Time</dt><dd id="endTime">{% if job.end_time > 0 %}{{ job.end_time_datetime_local }}{% else %}Not yet finished{% endif %}</dd>
	<dt>Options</dt><dd>{% for option in job.options %}{{ option.friendly }}<br>{% endfor %}</dd>
	<dt>Queue Name</dt><dd id="queue"><a href='{% url "olw_queue_view" job.queue.name %}'>{{ job.queue.name }}</a></dd>
	<dt>Requested Hosts</dt><dd>{% for host in job.requested_hosts %}{{ host.name }} {% empty %}No hosts requested{% endfor %}</dd>
	<dt>Requested Resources</dt><dd>{{ job.requested_resources|default:"Not Specified" }}</dd>
	<dt>Max Num Processors</dt><dd>{{ job.max_requested_slots }}</dd>
	<dt>Dependency Conditions</dt><dd>{{ job.dependency_condition|default:"Not Specified" }}</dd>
	<dt>Begin Time</dt><dd>{% if job.begin_time > 0 %}{{ job.begin_time_datetime_local }}{% else %}Not Specified{% endif %}</dd>
	<dt>Termination Deadline</dt><dd>{% if job.termination_time > 0 %}{{ job.termination_time_datetime_local }}{% else %}Not Specified{% endif %}</dd>
	<dt>Input File</dt><dd>{{ job.input_file_name }}</dd>
	<dt>Output File</dt><dd>{{ job.output_file_name }}</dd>
	<dt>Error File</dt><dd>{{ job.error_file_name }}</dd>
	<dt>Command</dt><dd>{{ job.command }}</dd>
	<dt>Email User</dt><dd>{{ job.email_user|default:"Not Specified" }}</dd>
	<dt>Project</dt><dd>{% for project in job.project_names %}{{ project }} {% empty %}No Projects {% endfor %}</dd>
	<dt>Groups</dt><dd>{% for group in job.group_names %}{{ group }} {% empty %}No groups{% endfor %}<dd>
	<dt>User Priority</dt><dd>{{ job.user_priority }}</dd>

	{% if job.cluster_type == "openlava" %}
	<dt>Checkpoint Period</dt><dd>{% if job.checkpoint_period > 0 %}{{ job.checkpoint_period_timedelta }}{% else %}Not checkpointable{% endif %}</dd>
	<dt>Checkpoint Dir</dt><dd>{{ job.checkpoint_directory|default:"Not checkpointable" }}</dd>
	<dt>CPU Factor</dt><dd id="cpu_factor">{{ job.cpu_factor }}</dd>
	<dt>Execution Current Working Directory</dt><dd id="executionCwd">{{ job.execution_cwd }}</dd>
	<dt>Execution Home Directory</dt><dd id="executionHomeDir">{{ job.execution_home_directory|default:"Not Available" }}</dd>
	<dt>Execution User</dt><dd id="executionUserName">{{ job.execution_user_name }} ({{ job.execution_user_id }})</dd>
	<dt>Host Specification</dt><dd>{{ job.host_specification|default:"Not Specified" }}</dd>
	<dt>Number of Processors</dt><dd>{{ job.requested_slots }}</dd>
	<dt>Login Shell</dt><dd>{{ job.login_shell|default:"Default"}}</dd>
	<dt>Parent Group</dt><dd>{{ job.parent_group }}</dd>
	<dt>Pre Execution Command</dt><dd>{{ job.pre_execution_command|default:"Not Specified" }}</dd>
	<dt>Resource Usage Last Updated</dt><dd id="resourceUsageLastUpdateTime">{{ job.resource_usage_last_update_time_datetime }}</dd>
	<dt>Service Port</dt><dd id="servicePort">{{ job.service_port }}</dd>
	<dt>Submit Home Directory</dt><dd>{{ job.submit_home_directory }}</dd>
	<dt>Termination Signal Value</dt><dd>{{ job.termination_signal|default:"Not Specified" }}</dd>
	{% endif %}
</dl>


<h1>Runtime Resource Limits</h1>
<table class="table table-striped table-condensed">
    <thead>
        <tr>
            <th>Resource</th>
            <th>Soft Limit</th>
            <th>Hard Limit</th>
        </tr>
    </thead>
    <tbody>
		{% for res in job.runtime_limits %}
        <tr>
			<td>{{ res.name }}</td>
			<td>{% if job.cluster_type == "openlava" and res.soft_limit == -1 %}Unlimited{% else %} {{ res.soft_limit }}{% if res.unit %} {{ res.unit }}{% endif %}{% endif %}</td>
			<td>{% if job.cluster_type == "openlava" and res.hard_limit == -1 %}Unlimited{% else %} {{ res.hard_limit }}{% if res.unit %} {{ res.unit }}{% endif %}{% endif %}</td>
        </tr>
		{% endfor %}
	</tbody>
</table>


<h1>Resource Usage</h1>
<table class="table table-hover table-condensed">
	<thead>
		<tr>
			<th>Field</th><th>Value</th><th>Limit</th>
		</tr>
	</thead>
<tbody id="consumedResources">
	{% for res in job.consumed_resources %}
	<tr><th>{{ res.name }}</th><td>{{ res.value }}{% if res.unit %} {{ res.unit }}{% endif %}</td><td>{{ res.limit|default:"No Limit" }}</td></tr>
	{% endfor %}
</tbody>
</table>

<h1>Active Processes</h1>
<table class="table table-hover table-condensed">
	<thead>
		<tr>
			<th>Hostname</th>
			<th>Process ID</th>
			{% if job.cluster_type == "openlava" %}
			<th>Parent Process ID</th>
			<th>Group ID</th>
			<th>Cray Job ID</th>
			{% endif %}
		</tr>
	</thead>
	<tbody id="processes">
		{% for proc in job.processes %}
            <tr>
                <td>{{ proc.hostname|default:"Unknown" }}</td>
                <td>{{ proc.process_id }}</td>
                {% if job.cluster_type == "openlava" %}
                <td>{{ proc.parent_process_id }} </td>
                <td>{{ proc.process_group_id }}</td>
                <td>{{ proc.cray_job_id }}</td>
                {% endif %}
            </tr>
		{% empty %}
            {% if job.cluster_type == "openlava" %}
                <tr><td colspan=5>No Processes</td></tr>
            {% else %}
                <tr><td colspan=2>No Processes</td></tr>
            {% endif %}
		{% endfor %}
	</tbody>
</table>
{% endblock %}
